from django.db import models

# Create your models here.
class Question(models.Model):
    question_text = models.CharField(max_length=200) # 字符串型，最长长度200字节
    pub_date = models.DateTimeField('date pubulished') # 日期字段
    def __str__(self):
        return self.question_text


class Choice(models.Model):
    question = models.ForeignKey(Question, on_delete=models.CASCADE)
    Choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)  # 数字型，默认为0
    def __str__(self):
        return self.Choice_text